#pragma once
#include "defines.h"
#include "event/events.h"

namespace vkrender
{
    struct Camera2D
    {
    private:
        glm::vec2 pos;
        float rotation;
        float scale;
    public:
        Camera2D();

        glm::mat4 getProjectionMatrix() const { return glm::mat4(1.0f); }
        glm::mat4 getViewMatrix() const;

        void zoom(float dz);
        void move(float dx, float dy);
        void rotate(float dt);

    private:
        static bool on_key_pressed(EventType eventType, void* sender, void* listener, void* context);
    };

    struct Camera3D
    {
    private:
        float pitch;
        float yaw;

        glm::vec3 pos;
        glm::vec3 up;
        glm::vec3 worldUp;
    public:
        Camera3D(const glm::vec3& pos = glm::vec3(0.0f, 0.0f, 0.0f), float yaw = 0.0f, float pitch = 0.0f);
        glm::mat4 getProjectionMatrix(uint32_t width, uint32_t height) const;
        glm::mat4 getViewMatrix() const;
        void translate(float dx, float dy, float dz);
        void rotate(float dyaw, float dpitch);

    private:
        glm::vec3 getFrontVector() const;
        void updateVectors();
        static bool on_key_pressed(EventType type, void* sender, void* listener, void* context);
    };
}
